<?php


namespace app\api\model;


use think\Model;

class UserInfoModel extends Model
{

    // 表名
    protected $name = 'user_info';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_text',
    ];

    public function getTypeTextAttr($val,$data)
    {
        $typeInfo = InfoTypeModel::get(['id'=>$data['type_id']]);

        return $typeInfo['name'];
    }

}